const InputSourceManager = imports.ui.status.keyboard;
const IBusManager = imports.misc.ibusManager;
const BoxPointer = imports.ui.boxpointer;
-const Layout = imports.ui.layout;
const Main = imports.ui.main;
const PageIndicators = imports.ui.pageIndicators;
const PopupMenu = imports.ui.popupMenu;
-var KEYBOARD_REST_TIME = Layout.KEYBOARD_ANIMATION_TIME * 2;
+var KEYBOARD_ANIMATION_TIME = 150;
+var KEYBOARD_REST_TIME = KEYBOARD_ANIMATION_TIME * 2;
var KEY_LONG_PRESS_TIME = 250;
var PANEL_SWITCH_ANIMATION_TIME = 500;
var PANEL_SWITCH_RELATIVE_DISTANCE = 1 / 3; /* A third of the actor width */
this._keyboard.setCursorLocation(null);
this._keyboard.destroy();
this._keyboard = null;
- Main.layoutManager.hideKeyboard(true);
}
}
var Keyboard = GObject.registerClass(
class Keyboard extends St.BoxLayout {
_init() {
- super._init({ name: 'keyboard', vertical: true });
+ super._init({ name: 'keyboard', reactive: true, vertical: true });
this._focusInExtendedKeys = false;
this._emojiActive = false;
Main.layoutManager.untrackChrome(this);
Main.layoutManager.keyboardBox.remove_actor(this);
+ Main.layoutManager.keyboardBox.hide();
if (this._languagePopup) {
this._languagePopup.destroy();
Main.layoutManager.keyboardIndex = monitor;
this._relayout();
- Main.layoutManager.showKeyboard();
+ this.animateShow();
this._setEmojiActive(false);
if (this._keyboardRequested)
return;
- Main.layoutManager.hideKeyboard();
+ this.animateHide();
this.setCursorLocation(null);
}
+ animateShow() {
+ Main.layoutManager.keyboardBox.show();
+ this.ease({
+ translation_y: -this.height,
+ opacity: 255,
+ duration: KEYBOARD_ANIMATION_TIME,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ onComplete: () => {
+ this._animateShowComplete();
+ },
+ });
+ Main.layoutManager.emit('keyboard-visible-changed', true);
+ }
+
+ _animateShowComplete() {
+ let keyboardBox = Main.layoutManager.keyboardBox;
+ this._keyboardHeightNotifyId = keyboardBox.connect('notify::height', () => {
+ this.translation_y = -this.height;
+ });
+
+ // Queue a relayout so the keyboardBox can update its chrome region.
+ keyboardBox.queue_relayout();
+ }
+
+ animateHide(immediate) {
+ if (this._keyboardHeightNotifyId) {
+ Main.layoutManager.keyboardBox.disconnect(this._keyboardHeightNotifyId);
+ this._keyboardHeightNotifyId = 0;
+ }
+ this.ease({
+ translation_y: 0,
+ opacity: 0,
+ duration: immediate ? 0 : KEYBOARD_ANIMATION_TIME,
+ mode: Clutter.AnimationMode.EASE_IN_QUAD,
+ onComplete: () => {
+ this._animateHideComplete();
+ },
+ });
+
+ Main.layoutManager.emit('keyboard-visible-changed', false);
+ }
+
+ _animateHideComplete() {
+ Main.layoutManager.keyboardBox.hide();
+ }
+
resetSuggestions() {
if (this._suggestions)
this._suggestions.clear();
if (show) {
windowActor.ease({
y: windowActor.y - deltaY,
- duration: Layout.KEYBOARD_ANIMATION_TIME,
+ duration: KEYBOARD_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => {
this._windowSlideAnimationComplete(window, -deltaY);
} else {
windowActor.ease({
y: windowActor.y + deltaY,
- duration: Layout.KEYBOARD_ANIMATION_TIME,
+ duration: KEYBOARD_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_IN_QUAD,
onComplete: () => {
this._windowSlideAnimationComplete(window, deltaY);
const Ripples = imports.ui.ripples;
var STARTUP_ANIMATION_TIME = 500;
-var KEYBOARD_ANIMATION_TIME = 150;
var BACKGROUND_FADE_ANIMATION_TIME = 1000;
var HOT_CORNER_PRESSURE_THRESHOLD = 100; // pixels
this.emit('startup-complete');
}
- showKeyboard() {
- this.keyboardBox.show();
- this.keyboardBox.ease({
- translation_y: -this.keyboardBox.height,
- opacity: 255,
- duration: KEYBOARD_ANIMATION_TIME,
- mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- onComplete: () => {
- this._showKeyboardComplete();
- },
- });
- this.emit('keyboard-visible-changed', true);
- }
-
- _showKeyboardComplete() {
- // Poke Chrome to update the input shape; it doesn't notice
- // anchor point changes
- this._updateRegions();
-
- this._keyboardHeightNotifyId = this.keyboardBox.connect('notify::height', () => {
- this.keyboardBox.translation_y = -this.keyboardBox.height;
- });
- }
-
- hideKeyboard(immediate) {
- if (this._keyboardHeightNotifyId) {
- this.keyboardBox.disconnect(this._keyboardHeightNotifyId);
- this._keyboardHeightNotifyId = 0;
- }
- this.keyboardBox.ease({
- translation_y: 0,
- opacity: 0,
- duration: immediate ? 0 : KEYBOARD_ANIMATION_TIME,
- mode: Clutter.AnimationMode.EASE_IN_QUAD,
- onComplete: () => {
- this._hideKeyboardComplete();
- },
- });
-
- this.emit('keyboard-visible-changed', false);
- }
-
- _hideKeyboardComplete() {
- this.keyboardBox.hide();
- this._updateRegions();
- }
-
// setDummyCursorGeometry:
//
// The cursor dummy is a standard widget commonly used for popup